<?php
/**
 *
 */
class Users_model extends CI_Model {

    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 获取所欲数据
     * @return [type] [description]
     */
    public  function get_user_list()
    {
    	return $this->db->get('users')->result();
    }
    /**
     * 查询
     *  根据参数个数 查询
     */
    public function find_user()
    {
        $num = func_num_args();

        switch ($num) {
            case '1':
                $rs = $this->db->get('users',['id'=>func_get_arg(0)])->row();
                break;
            case '2':
                $rs = $this->db->get_where('users',['email'=>func_get_arg(0),'password'=>func_get_arg(1)])->row();
                break;
            default:
                $rs = '';
                break;
        }

        return $rs;
    }
}